<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <a href="taobao://item.taobao.com/item.html?id=41700658839">打开淘宝</a>
  <script>
    function navigotar() {
      // 判断浏览器
      var Navigator = navigator.userAgent;
      var ifChrome = Navigator.match(/Chrome/i) != null && Navigator.match(/Version\/\d+\.\d+(\.\d+)?\sChrome\//i) == null ? true : false;
      var ifAndroid = (Navigator.match(/(Android);?[\s\/]+([\d.]+)?/)) ? true : false;
      var ifiPad = (Navigator.match(/(iPad).*OS\s([\d_]+)/)) ? true : false;
      var ifiPhone = (!ifiPad && Navigator.match(/(iPhone\sOS)\s([\d_]+)/)) ? true : false;
      var ifIos = Navigator.match(/iPhone|iPad|iPd/i) ? true : false;
      var ifSafari = ifIos && Navigator.match(/Safari/);
      if (ifIos) {
        // ios 设备的版本号
        var iosVersion = Navigator.match(/OS\s*(\d+)/)
        iosVersion = iosVersion ? (iosVersion[1] || 0) : 0;
        alert('ios' + iosVersion);
        return false;
      }
      if (ifAndroid) {
        // 安卓版本号
        var androidVersion = Navigator.match(/Android\s*(\d+)/)
        androidVersion = androidVersion ? (androidVersion[1] || 0) : 0;
        alert('android' + androidVersion);
        return false;
      }

    }
    navigotar();
  </script>
</body>

</html>